import request from '@/utils/request'

// 查询自定义权益列表
export function listPrivilege(query) {
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege/list',
    method: 'get',
    params: query
  })
}

// 查询自定义权益详细
export function getPrivilege(privilegeUid) {
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege/' + privilegeUid,
    method: 'get'
  })
}

// 新增自定义权益
export function addPrivilege(data) {
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege',
    method: 'post',
    data: data
  })
}

// 修改自定义权益
export function updatePrivilege(data) {
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege',
    method: 'put',
    data: data
  })
}

// 删除自定义权益
export function delPrivilege(privilegeUid) {
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege/' + privilegeUid,
    method: 'delete'
  })
}

// 修改客户状态
export function updateCustomerStatus(privilegeUid, status){
  const data = {
    privilegeUid,
    status
  }
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege/updateCustomerStatus',
    method: 'put',
    data: data
  })
}

// 查询权益具体等级使用情况
export function getPrivilegeLevelInfo(privilegeName) {
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege/privilegeLevelInfo/'+privilegeName,
    method: 'get',
  })
}

// 查询权益信息
export function privilegeInfoList(query) {
  return request({
    url: '/prod-api/customer/levelPrivilege/privilege/privilegeInfo',
    method: 'get',
    params: query
  })
}
